<?php


namespace app\model;


use app\bocadmin\model\BocCate;
use think\db\Where;
use think\Model;

class BocRecruit extends Model
{

    protected $table = 'boc_recruit';

    public function get_list($where = ['is_deleted'=>0,'status'=>1],$title = 'id,title,time,money,jingyan,school,content,text1,address,left(create_at,10) as create_at',$order='sort desc,create_at desc'){

        $list = $this->field($title)->where($where)->order($order)->select();

        return $list?$list->toarray():[];
    }


    public function get_one($id,$title='id,title,content,text'){
        $list = $this->field($title)->where(['id'=>$id])->where(['is_deleted'=>0,'status'=>1])->find();
        return $list?$list->toarray():[];
    }


    public function course_cate()
    {
        return $this->hasOne(BocCate::class, 'id', 'cate_id');
    }
}